package com.darcytech.debezium.core.api.impl;

import com.darcytech.debezium.core.api.Api;
import com.darcytech.debezium.core.api.bo.RegisterInfo;
import com.darcytech.debezium.core.api.bo.RegisterResult;

import java.io.IOException;

public class ApiImpl extends ApiSender implements Api {

    @Override
    public RegisterResult registerConnector(RegisterInfo registerInfo) {
        try {
            return send(registerInfo, Binding.REGISTER.getType(), RegisterResult.class);
        } catch (IOException | InterruptedException e) {
            return new RegisterResult(RegisterResult.ERROR_CODE, "An exception occurred:" + e.getMessage());
        }
    }
}
